<%--
  Created by IntelliJ IDEA.
  User: Alan4
  Date: 2023/1/31
  Time: 11:35
  To change this template use File | Settings | File Templates.
--%>
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page isELIgnored="false"%>
		<%@include file="/public/head.jsp"%>
		<!-- Modal -->
		<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
		  <div class="modal-dialog  modal-dialog-centered">
			<div class="modal-content">
			  <div class="modal-header">
				<h1 class="modal-title fs-5" id="exampleModalLabel">用户信息录入<span style="font-size: 16px;color: red;">(请认真填写，默认密码为0000,请及时修改密码)</span></h1>
				<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
			  </div>
			  <div class="modal-body user-add-inputs">
				<input id="user-add-name" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="请输入姓名(必填)"/><br />
				<input id="user-add-gender" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="请输入你的性别(必填)"/><br />
				<input id="user-add-birthDate" class="department-add-input w-100" type="date" placeholder="请输入你的出生日期(必填)"/><br />
				<input id="user-add-jobTitle" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="请输入职称"/><br />
				<input id="user-add-education" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="请输入你的学历"/><br />
				<input id="user-add-degree" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="请输入学位"/><br />
				<input id="user-add-QQ" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="number" placeholder="请输入QQ"/><br />
				<input id="user-add-email" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="email" placeholder="请输入邮箱"/><br />
				<input id="user-add-introduction" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="请输入你的简介(一句话)"/><br />
				<select id="user-add-department" class="department-add-input w-100"></select>
			  </div>
			  <div class="modal-footer">
				<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
				<button id="user-add-submit-btn" type="button" class="btn btn-primary">提交</button>
			  </div>
			</div>
		  </div>
		</div>
		<!-- Modal -->
		<div class="modal fade" id="updateUserModal" tabindex="-1" aria-labelledby="updateUserModalModalLabel" aria-hidden="true">
		  <div class="modal-dialog  modal-dialog-centered">
			<div class="modal-content">
			  <div class="modal-header">
				<h1 class="modal-title fs-5" id="updateModalLabel">用户信息修改<span style="font-size: 16px;color: red;">(请认真填写)</span></h1>
				<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
			  </div>
			  <div class="modal-body user-add-inputs" id="user-update-get-inputs">
				<input id="user-update-code" title="工号"  class="department-add-input w-100" disabled type="text"/><br />
				<input id="user-update-name" title="姓名" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="请输入姓名(必填)"/><br />
				<input id="user-update-gender" title="性别" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="请输入你的性别(必填)"/><br />
				<input id="user-update-birthDate" title="出生日期" class="department-add-input w-100" type="date" placeholder="请输入你的出生日期(必填)"/><br />
				<input id="user-update-jobTitle" title="职称" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="请输入职称"/><br />
				<input id="user-update-education" title="学历" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="请输入你的学历"/><br />
				<input id="user-update-degree" title="学位" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="请输入学位"/><br />
				<input id="user-update-QQ" title="QQ" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="number" placeholder="请输入QQ"/><br />
				<input id="user-update-email" title="邮箱" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="email" placeholder="请输入邮箱"/><br />
				<input id="user-update-introduction" title="简介" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="请输入你的简介(一句话)"/><br />
				<input id="user-update-password" title="密码" onclick="clickSelectInputTextAll(this)" class="department-add-input w-100" type="text" placeholder="请输入你的密码"/><br />
				<select id="user-update-department" title="部门" class="department-add-input w-100"></select>
			  </div>
			  <div class="modal-footer">
				<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
				<button id="user-update-submit-btn" type="button" class="btn btn-primary">提交</button>
			  </div>
			</div>
		  </div>
		</div>
		<div class="row user-head">
		  <div class="col-md-4 text-center offset-md-1 col-12">
			<input type="text" id="user-search" value="${paging.fuzzyQuery}" placeholder="工号/姓名" />
			<input type="image" id="user-search-icon" src="${pageContext.request.contextPath}/public/search.png"/>
		  </div>
		  <div class="col-md-6 text-center col-12">
			<select id="user-select-departments">
				<option selected value="0">选择部门</option>
				<c:forEach items="${departments}" var="item">
					<option <c:if test="${item.id == paging.departmentId}">selected</c:if> value="${item.id}">${item.name}</option>
				</c:forEach>
			</select>
			<button type="button" id="user-btn-add" data-bs-toggle="modal" data-bs-target="#exampleModal">添加数据</button>
			<button id="user-btn-batch-deletion">批量删除</button>
		  </div>
		</div>

		<div class="row user-list">
		  <div class="col-md-10 offset-md-1 col-12 ">
			<table class="w-100 user-list-table">
			  <thead>
				<tr>
					<td class="w-auto"></td>
					<td class="w-auto">工号</td>
					<td class="w-auto">部门</td>
					<td class="w-auto">姓名</td>
					<td class="w-auto">性别</td>
					<td class="w-auto">出生日期</td>
					<td class="w-auto">学历</td>
					<td class="w-auto">学位</td>
					<td class="w-auto">职称</td>
					<td class="w-auto">邮箱</td>
					<td class="w-auto">QQ</td>
					<td class="w-auto">简介</td>
					<c:if test="${identity == '管理员'}"><td class="w-auto">密码</td></c:if>
					<td class="w-auto">操作</td>
				</tr>
			  </thead>
			  <tbody>
			  <c:forEach items="${paging.data}" var="item">
				<tr>
				  <td><input type="checkbox" name="code" value="${item.code}"></td>
				  <td title="${item.code}">${item.code}</td>
				  <td title="${item.department}">${item.department}</td>
				  <td title="${item.userName}">${item.userName}</td>
				  <td title="${item.gender}">${item.gender}</td>
				  <td title="${item.birthDate}">${item.birthDate}</td>
				  <td title="${item.education}">${item.education}</td>
				  <td title="${item.degree}">${item.degree}</td>
				  <td title="${item.jobTitle}">${item.jobTitle}</td>
				  <td title="${item.email}">${item.email}</td>
				  <td title="${item.qq}">${item.qq}</td>
				  <td title="${item.introduction}">${item.introduction}</td>
				  <c:if test="${identity == '管理员'}"><td title="${item.password}"><c:if test="${item.code != 10000001}">${item.password}</c:if></td></c:if>
				  <td><span style="color: #2F88FF;cursor: pointer;" data-bs-toggle="modal" data-bs-target="#updateUserModal" onclick="userUpdateModelBtn(${item.code})">修改</span></td>
				</tr>
			  </c:forEach>
			  </tbody>
			</table>
		  </div>
		</div>
		<div class="row user-paging">
		  <div class="col-md-9 offset-md-1">
			<span style="color: #2F88FF;cursor: pointer;<c:if test="${paging.pageNow == 1}">pointer-events:none;color: gray;</c:if>" id="user-pre-page">上一页</span>
			( <span id="user-page-now">${paging.pageNow}</span> )
			<span style="color: #2F88FF;cursor: pointer;<c:if test="${paging.pageNow == paging.pageCount}">pointer-events:none;color: gray;</c:if>" id="user-next-page">下一页</span>
			&nbsp;&nbsp;共${paging.pageCount}页${paging.rowCount}条数据
		  </div>
		  <div class="col-md-1 text-center">
			<select id="user-set-page-size">
			  <option <c:if test="${paging.pageSize == 5}">selected</c:if> value="5">5条/页</option>
			  <option <c:if test="${paging.pageSize == 10}">selected</c:if> value="10">10条/页</option>
			  <option <c:if test="${paging.pageSize == 20}">selected</c:if> value="20">20条/页</option>
			  <option <c:if test="${paging.pageSize == 50}">selected</c:if> value="50">50条/页</option>
			  <option <c:if test="${paging.pageSize == 100}">selected</c:if> value="100">100条/页</option>
			  <option <c:if test="${paging.pageSize == 200}">selected</c:if> value="200">200条/页</option>
			</select>
		  </div>
		</div>
		<%@include file="/public/foot.jsp"%>